/*
 * One example for NOI CSP-J Lesson 10:
 * <https://courses.fmsoft.cn/plzs/noijunior-csp-exercises-lower.html>
 *
 * Author: Vincent Wei
 *  - <https://github.com/VincentWei>
 *  - <https://gitee.com/vincentwei7>
 *
 * Copyright (C) 2025 FMSoft <https://www.fmsoft.cn>.
 * License: GPLv3
 */
#include <iostream>
#include <vector>
#include <cassert>

using namespace std;

int take_apples(int n, int& day_got_n)
{
    vector<int> left_apples;
    for (int i = 1; i <= n; i++) {
        left_apples.push_back(i);
    }

    int days = 0;
    while (left_apples.size() > 0) {
        size_t sz = left_apples.size();

        vector<int> tmp_apples;
        for (size_t i = 0; i < sz; i += 3) {
            if (left_apples[i] == n)
                day_got_n = days + 1;
            if ((i + 1) < sz)
                tmp_apples.push_back(left_apples[i + 1]);
            if ((i + 2) < sz)
                tmp_apples.push_back(left_apples[i + 2]);
        }

        days++;
        left_apples = tmp_apples;
    }

    return days;
}

int main()
{
    int days, day_got_n;

    days = take_apples(1, day_got_n);
    assert(days == 1);
    assert(day_got_n == 1);

    days = take_apples(4, day_got_n);
    assert(days == 3);
    assert(day_got_n == 1);

    days = take_apples(8, day_got_n);
    assert(days == 5);
    assert(day_got_n == 5);
    clog << "Test passed" << endl;

    int n;
    cin >> n;
    days = take_apples(n, day_got_n);
    cout << days << " " << day_got_n << endl;
    return 0;
}

